from selenium import webdriver
from selenium.webdriver.support.select import Select
from bs4 import BeautifulSoup
import time
import datetime

chrome_options = webdriver.ChromeOptions()
# chrome_options.add_argument('--headless')
# chrome_options.add_argument('--disable-gpu')
client = webdriver.Chrome(executable_path='D:\webdrivers\chromedriver.exe',
                          options=chrome_options)
#gitlab登录地址
url = "https://www.tapd.cn/cloud_logins/login"
#管理员账号
username="jiyu@newspiral.net"
#管理员密码
passwd="Welcome1"

class tapdmanager(object):
    def __init__(self, email="", item=""):

    #员工的email地址
        self.email = email
    #员工的英文拼音
        self.item = item
    def Login(self):
        client.get(url)
    #账号登录-输入账号密码
        elemid = client.find_element_by_xpath("/html/body/div/form/div[2]/div/input")
        elempasswd = client.find_element_by_xpath("/html/body/div/form/div[3]/div/input")
        time.sleep(1)
        elemid.send_keys(username)
        elempasswd.send_keys(passwd)
    #点击登录
        elemlogin = client.find_element_by_xpath("/html/body/div/form/div[4]/input[1]")
        elemlogin.click()
    def Register(self):
    #点击设置
        client.find_element_by_xpath("/html/body/div[1]/div[1]/div[6]/div[1]/a").click()
        time.sleep(1)
    #点击添加成员
        client.find_element_by_xpath("/html/body/div[3]/div[3]/div/div[2]/div/div[1]/div[1]/ul/li[1]").click()
        client.find_element_by_xpath("/html/body/div[20]/div[2]/div[2]/div/form/div[1]").send_keys(self.email)